<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        var arr = [2,3,4]
        function fn(a, b, c){
            console.log(a, b, c)
        }
        fn(arr[0], arr[1], arr[2])
        fn(...arr)

        var arr1 = [...arr] //浅拷贝数组arr 数组里面的值是一样的，但是数组的地址不同
        var arr2 = [20, ...arr, 50]
        console.log(arr1)
        console.log(arr2)
        console.log(arr === arr1)

        var obj = {
            name: 'zhangsan',
            age: 20
        }
        console.log(obj)
        var obj1 = {...obj} //浅拷贝obj 数组里面的值是一样的，但是数组的地址不同
        console.log(obj1)

        console.log(obj1 === obj) 
        var obj2 = {agee :18, ...obj,name:'lisi'}
        console.log(obj2)

        //rest  运算符，将展开的内容合并为一个数组

        function fn2(...arr3) {
            console.log(arr3) //5,89,13,56,3,66
            // console.log(a) //2
        }
        fn2(2,5,89,13,56,3,66)
    </script>
</body>
</html>